define(function(){
	function index(){
		$(function(){
			//nav
			$(".ul-con li").hover(function(){
				$(this).css({
					"background" : "white"
					});
				$(this).find(".sub").css("color","#E5004A");
				$(this).find(".sub").find("span").css("background-positionX","-35px");
				$(this).find(".sub").find("i").css("background-positionX","-35px");
				$(this).find(".menu").css("display","block");
			},function(){
				$(this).css({
					"background" : "#e500a"
					});
				$(this).find(".sub").css("color","white");
				$(this).find(".sub").find("span").css("background-positionX","0");
				$(this).find(".sub").find("i").css("background-positionX","0");
				$(this).find(".menu").css("display","none");
			})
		//banner slider
			$(".banner").hover(function(){
				$(this).find(".btnL").animate({"opacity" : "0.3"},200);
				$(this).find(".btnR").animate({"opacity" : "0.3"},200);
			},function(){
				$(this).find(".btnL").animate({"opacity" : "0"},200);
				$(this).find(".btnR").animate({"opacity" : "0"},200);
			})
			$(".banner .btnL").hover(function(){
				$(this).animate({"opacity" : "0.7"},200);
				$(this).animate({"opacity" : "0.7"},200);
			},function(){
				$(this).animate({"opacity" : "0.3"},200);
				$(this).animate({"opacity" : "0.3"},200);
			})
			$(".banner .btnR").hover(function(){
				$(this).animate({"opacity" : "0.7"},200);
				$(this).animate({"opacity" : "0.7"},200);
			},function(){
				$(this).animate({"opacity" : "0.3"},200);
				$(this).animate({"opacity" : "0.3"},200);
			})
		//case
			function count(){
				var date = new Date();
				var now = date.getTime();
				var cutTime = new Date("2017-12-27 21:40:00");
				var cut = cutTime.getTime();
				var mist = cut - now;
				
				var d,h,m,s;
				if(mist >= 0){
					d = Math.floor(mist / 1000 / 60 / 60 / 24);
					h = Math.floor(mist / 1000 / 60 / 60 % 24);
					m = Math.floor(mist / 1000 / 60 % 60);
					s = Math.floor(mist / 1000 % 60);
				}
				$(".day").html(d);
				$(".hour").html(h);
				$(".min").html(m);
				$(".sec").html(s);
			}
			setInterval(function(){
				count();
			},1000);
			
			$(".mark").hover(function(){
				$(this).css("opacity",1);
				$(this).find("a").animate({"left": "32px"},500).show();
			},function(){
				$(this).css("opacity",0);
				$(this).find("a").animate({"left": "-84px"},100).hide();
			})
			//sale
			$(".trad").hover(function(){
				$(this).find("figcaption").stop().animate({"bottom":"0px"},500).find(".f1").animate({"bottom":"0px"},700).next().animate({"bottom":"0px"},800);
			},function(){
				$(this).find("figcaption").stop().animate({"bottom":"-56px"},500).find(".f1").animate({"bottom":"-56px"},700).next().animate({"bottom":"-56px"},800);
			})
			
			//floor
			function slide(className){
				var timer = null;
				$(".fl").click(function(){
					$(className).stop().animate({"left" : 0},1000,function(){
						$(this).css("left",-195);
						$(this).find("li:last").prependTo($(className));
					})
				})
				//给右按钮添加点击事件
				$(".fr").click(function(){
						$(className).stop().animate({"left" : -195},1000,function(){
							$(this).css("left",0);
							$(this).find("li:eq(0)").appendTo($(className));
						})
				})
				function autoPlay(){
					timer = setInterval(function(){
						$(className).stop().animate({"left" : -195},1000,function(){
							$(this).css("left",0);
							$(this).find("li:eq(0)").appendTo($(className));
						})
					},2000)
				}
				autoPlay();
				$(".nav-slide-con").hover(function(){
					clearInterval(timer);
				},function(){
					autoPlay();
				})
				$(".fl").hover(function(){
					clearInterval(timer);
				},function(){
					autoPlay();
				})
				$(".fr").hover(function(){
					clearInterval(timer);
				},function(){
					autoPlay();
				})
			}
			slide(".nav-slide1");
			slide(".nav-slide2");
			slide(".nav-slide3");
			slide(".nav-slide4");
			slide(".nav-slide5");
			
			
			$(".floor-l").hover(function(){          
		        $(this).find("img").css({"transform":"scale(1.05)",
		        			"transition" : "all 1.5s"
		        });
			},function(){
				$(this).find("img").css("transform","scale(1)");
			})
			
			$(".floo-r-img").hover(function(){
				$(this).stop().animate({"left":"7px"},500);
			},function(){
				$(this).stop().animate({"left":"17px"},500);
			})
			$(".floor-r-img").hover(function(){
				$(this).stop().animate({"left":"38px"},500);
			},function(){
				$(this).stop().animate({"left":"48px"},500);
			})
		})
	}
	return{
		index : index
	}
})
	


